#!/usr/bin/env bash

init_ufw()
{
     sudo ufw enable
     sudo ufw default deny
     sudo ufw reload
     sudo ufw status
}

allow_port_for_wf()
{
    #SMB端口139或445 (SMB Port 139 or 445)
    ports=(139 445 9445 9139   #for samba
        9922 22 
        9418       #git
        7300 9900 80 443 #http
        5900 5901  #vncserver
        8118 #privoxy
        1080 #socks
    )
    #sudo ufw allow 

    for port in ${ports[@]}
    do
        sudo ufw allow $port
    done
}

main()
{
    allow_port_for_wf 

    init_ufw
    return 0
}

main && exit 0 || exit 1
